
class EmbbedConsole
  def puts a_obj
    a_obj.to_s.each_line do |line|
      VIM::message line
    end
  end
end    


class VimStdOut < IO
  def initialize console = nil
    @console = console
    super(2, 'w')
  end

  def write a_string
    @console.puts a_string if @console
  end

  def puts a_string
    @console.puts a_string if @console
  end
end


class UIConsole
  def puts a_string
    p 'in ui console'
    $wr.puts "log '#{a_string}'"
#    $wr.flush
  end
end

$vim_std_out = VimStdOut.new(UIConsole.new)

alias $defout $vim_std_out
alias $0 $current_vim_file

$current_vim_file = ""

$0 = "evil"
$> = $vim_std_out

ARGV[0] = "settings.rb"
